﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="CustomerAdd.aspx.cs" Inherits="Customer_Profile.ClientManage.CustomerAdd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Customer Add</title>
    <meta name="vs_snapToGrid" content="False">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="/css/style.css" rel="stylesheet" type="text/css">

    

    <script language="javascript" type="text/javascript" src="/js/common.js"></script>

    <script language="javascript" type="text/javascript" src="/js/CalPopUp.js"></script>
    <script type="text/javascript" language="javascript">       
        //var inputname = ""; 
        function SHowStr(name)
        {   
            var sUrl ='';
            var guid ='<%=sGuid %>';
            //inputname = Name;
            if(name=='txtibid')
            {
                sUrl = 'CheckExist.aspx';                
            }
            else
            {
                sUrl='CheckExistName.aspx';
            }
	        var sIbid = Jtrim(document.getElementById(name).value);	        
        	if(sIbid=="")
        	{
        	    alert("IBID must fill");
        	    return false;
        	}
	        
	        var sSendStr = 'ID=' + sIbid+'&guid='+guid;
	        xmlHttp = createXMLHttp();
	        try
	        {
		        xmlHttp.abort();
		        xmlHttp.open('POST', sUrl);
		        if(name=='txtibid')
		        {
		            xmlHttp.onreadystatechange = a;
		        }
		        else
		        {
		            xmlHttp.onreadystatechange = b;
		        }
		        xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		        xmlHttp.send(sSendStr);
	        }
	        catch (e){alert (e);}
	        finally
	        {
	        }
	        return false;
        }
        function a()
        {
            //name ='lb'+name;
            //alert(name);
	        if (xmlHttp.readyState==4)
	        {
		        if (xmlHttp.status==200)
		        {					    
			        document.getElementById('lbibid').innerHTML=xmlHttp.responseText;
			        
			        if(xmlHttp.responseText=="<span style=\"color:#880000\">ID can use</span>")
			        {			            
			            document.getElementById("hiddenflag").value = "YES";			            
			        }
			        else
			        {
			            document.getElementById("hiddenflag").value = "No";
			        }
		        }
	        }
        }
        function b()
        {
	        if (xmlHttp.readyState==4)
	        {
		        if (xmlHttp.status==200)
		        {					    
			        document.getElementById('lbibloginname').innerHTML=xmlHttp.responseText;
			        
			        if(xmlHttp.responseText=="<span style=\"color:#880000\">Name can use</span>")
			        {			            
			            document.getElementById("hiddenflagname").value = "YES";
			        }
			        else
			        {
			            document.getElementById("hiddenflagname").value = "No";
			        }
		        }
	        }
        }
        function createXMLHttp()
        {
	        var objXMLHttp=null; 
	        try 
	        { 
		        objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
	        }
	        catch(e)
	        { 
		        try 
		        { 
			        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
		        }
		        catch(oc)
		        { 
			        objXMLHttp=null 
		        } 
	        } 
	        if ( !objXMLHttp && typeof XMLHttpRequest != "undefined" ) 
	        { 
		        objXMLHttp=new XMLHttpRequest();
	        } 
	        return objXMLHttp;
        }
    
        function check()
        {            
            var temp11 = document.getElementById("hiddenflag").value;            
            if(Jtrim(document.getElementById('txtfirstname').value)=='')
	         {
	            alert('FirstName Must Fill!');
	            return false;
	         }
	         if(Jtrim(document.getElementById('txtlastname').value)=='')
	         { 
	            alert('Last Name Must Fill!');
	            return false;
	         }
	         if(Jtrim(document.getElementById('txtibid').value)=='')
	         {
	            alert('IB ID Must Fill!');
	            return false;
	         }
	         if(Jtrim(document.getElementById('txtibloginname').value)=='')
	         {
	            alert('IB LoginName Must Fill!');
	            return false;
	         }
	         if(Jtrim(document.getElementById("txtemail").value)!='')
	         {
	             if(!checkEmail(document.getElementById("txtemail").value))
                 {
                    alert('Please insert current E-mail');
                    return false;
                 }
             }
	         return true;
        }
        //验证Email地址是否正确
         function checkEmail(str)
        {	
	        var emailPat = /^([A-Z0-9a-z_\-\.]+)@([A-Z0-9a-z_\-\.]+)$/;
	        var matchArray = str.match(emailPat); 
	        if (matchArray==null)
		        return false;
	        var pos = matchArray[2].indexOf(".");
	        if(pos == -1)
		        return false;
	        return true;
        }
        
        function Jtrim(str) //去空隔函数
        {
            var i = 0;
            var len = str.length;
            if ( str == "" ) return( str );
            j = len -1;
            flagbegin = true;
            flagend = true;
            while ( flagbegin == true && i< len)
            {
                if ( str.charAt(i) == " " )
                {
                    i=i+1;
                    flagbegin=true;
                }
                else
                {
                    flagbegin=false;
                }
            }
            while (flagend== true && j>=0)
            {
                if (str.charAt(j)==" ")
                {
                    j=j-1;
                    flagend=true;
                }
                else
                {
                    flagend=false;
                }
            }
            if ( i > j ) return ("")
            trimstr = str.substring(i,j+1);
            return trimstr;
        }
    </script>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
    <form id="form1" runat="server">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="1" background="/images/dot_vline.gif">
                    <img height="1" src="/images/spacer.gif" width="1"></td>
                <td valign="top" width="15">
                    <img height="1" src="/images/spacer.gif" width="15"></td>
                <td valign="top">
                    <table cellspacing="0" cellpadding="0" width="100%" border="0">
                        <tr>
                            <td height="23">
                                <span class="navi-blu"><span class="navi-blk">Index &gt; Customer Manage &gt;
                                    <%=action %>
                                </span></span>
                            </td>
                        </tr>
                        <%--<tr>
                            <td background="/images/dot_hline.gif">
                                <img height="1" src="/images/spacer.gif" width="1"></td>
                        </tr>--%>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td bgcolor="#1765a7">
                                <img src="/images/spacer.gif" width="1" height="3"></td>
                        </tr>
                        <tr>
                            <td>
                                <img src="/images/spacer.gif" width="1" height="1"></td>
                        </tr>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <%--<tr> 
                            <td class="bglist1">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="12" class="bglist1">
                                            <img src="/images/arw_blu_rgt.gif" width="4" height="7"></td>
                                        <td class="bglist1">
                                            Basic Personal Information</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>--%>
                        <tr>
                            <td>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td class="bglist-3" width="12%">
                                            IB ID：</td>
                                        <td class="bglist-4"  width="21%">
                                            <input width="80%" class="input3" id="txtibid" type="text" onblur="JavaScript:return SHowStr(this.id);" name="txtName" runat="server"><asp:Label ID="lbibid" runat="server" Text=""></asp:Label></td>
                                        <td class="bglist-3" width="13%">
                                            IB login Name：</td>
                                        <td class="bglist-4" width="21%">
                                            <input width="80%" id="txtibloginname" runat="server" onblur="JavaScript:return SHowStr(this.id);" class="input3" name="txtName" 
                                                type="text" /><asp:Label ID="lbibloginname" runat="server" Text=""></asp:Label>
                                        </td>
                                        <td class="bglist-3" width="12%">
                                            Phone Pwd：</td>
                                        <td class="bglist-4" width="21%">
                                            <input width="80%" class="input3" id="txtphonepassword" type="text"  name="txtAddress" runat="server"></td>
                                    </tr>
                                    <tr>
                                        <td class="bglist-3">
                                            Title：</td>
                                        <td class="bglist-4">
                                            <asp:DropDownList width="80%" ID="ddltitle"  CssClass="input3" runat="server">
                                                <asp:ListItem Text="MR." Value="MR."></asp:ListItem>
                                                <asp:ListItem Text="Mrs." Value="Mrs."></asp:ListItem>
                                                <asp:ListItem Text="Miss." Value="Miss."></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                        <td class="bglist-3">
                                            First Name：</td>
                                        <td  class="bglist-4">
                                            <input width="80%" class="input3" id="txtfirstname" type="text"  name="textfield2" runat="server"></td>
                                        <td class="bglist-3">
                                            Last Name：</td>
                                        <td class="bglist-4">
                                            <input width="80%" class="input3" id="txtlastname" type="text"  name="textfield" runat="server"></td>
                                    </tr>
                                    <tr>
                                        <td class="bglist-3">
                                            Advisor：</td>
                                        <td class="bglist-4" >
                                            <asp:DropDownList width="80%" ID="ddlAdvisor"  CssClass="input3" runat="server" />
                                        </td>
                                        <td class="bglist-3">
                                            Location ：</td>
                                        <td class="bglist-4">
                                            <asp:DropDownList width="80%" ID="ddllocal"  CssClass="input3" runat="server" /></td>
                                        <td class="bglist-3">
                                            Status ：</td>
                                        <td class="bglist-4" >
                                            <asp:DropDownList width="80%" ID="ddlstatus"  CssClass="input3" runat="server" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="bglist-3">
                                            FIN No.：</td>
                                        <td class="bglist-4" >
                                            <input width="80%" class="input3" id="txtfinno" type="text"  name="txtName" runat="server"></td>
                                        <td class="bglist-3">
                                            CSN No.：</td>
                                        <td class="bglist-4">
                                            <input width="80%" id="txtcsnno" runat="server" class="input3" name="txtName"  type="text" />
                                        </td>
                                        <td class="bglist-3">
                                            Date Of Birth：</td>
                                        <td class="bglist-4">
                                            <input width="80%" id="txtbirthday" runat="server" class="input3" name="txtName"  type="text" />&nbsp;
                                            <img
                                                style="cursor: hand" onclick="JavaScript:calPopForCMon(txtbirthday, 'ss');"
                                                height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <img src="/images/spacer.gif" width="1" height="5"></td>
                        </tr>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td bgcolor="#1765a7">
                                <img src="/images/spacer.gif" width="1" height="3"></td>
                        </tr>
                        <%--<tr>
                            <td>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="12" class="bglist1">
                                            <img src="/images/arw_blu_rgt.gif" width="4" height="7"></td>
                                        <td class="bglist1">
                                            Business Personal Information</td>
                                    </tr>
                                </table>
                            </td>
                        </tr>--%>
                        <tr>
                            <td>
                                <img src="/images/spacer.gif" width="1" height="1"></td>
                        </tr>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="bglist-3" width="12%">
                                Home No.：</td>
                            <td  class="bglist-4" width="21%">
                                <input width="80%" class="input3" id="txthometel" type="text"  name="textfield2" runat="server"/></td>
                            <td class="bglist-3" width="12%">
                                Work No.：</td>
                            <td class="bglist-4" width="21%">
                                <input width="80%" class="input3" id="txtworktel" type="text"  name="textfield" runat="server"/></td>
                            <td class="bglist-3" width="12%">
                                Fax No.：</td>
                            <td  class="bglist-4" width="21%">
                                <input width="80%" class="input3" id="txtfax" type="text"  name="textfield2" runat="server"/></td>
                        </tr>
                        <tr>
                            <td class="bglist-3">
                                Address：</td>
                            <td class="bglist-4" colspan="3">
                                <input style="width:92%" class="input3" id="txtaddress" type="text"  name="textfield2" runat="server"/></td>
                            <td class="bglist-3">
                                Email：</td>
                            <td class="bglist-4">
                                <input width="80%" class="input3" id="txtemail" type="text"  name="textfield" runat="server"/></td>
                        </tr>
                        <tr>
                            <td class="bglist-3">
                                City：</td>
                            <td class="bglist-4">
                                <input width="80%" class="input3" id="txtcity" type="text"  name="textfield52" runat="server"/></td>
                            <td class="bglist-3">
                                Region/Province：</td>
                            <td  class="bglist-4" colspan="3">
                                <input width="92%" class="input3" id="txtprovince" type="text"  name="textfield2" runat="server"/></td>
                        </tr>
                        <tr>
                            <td class="bglist-3">
                                Country：</td>
                            <td class="bglist-4">
                                <input width="80%" class="input3" id="txtCountry" type="text"  name="textfield" runat="server"/></td>
                            <td class="bglist-3">
                                Postal code：</td>
                            <td class="bglist-4" colspan="3">
                                <input width="92%" class="input3" id="txtpostcode" type="text"  name="textfield" runat="server"/></td>
                        </tr>
                    </table>
                    
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <img src="/images/spacer.gif" width="1" height="5"></td>
                        </tr>
                        <tr>
                            <td bgcolor="#1765a7"><strong><span style="color:#FFFFFF;">&nbsp;&nbsp;Authorised Person</span></strong>
                                <img src="/images/spacer.gif" width="1" height="3"></td>
                        </tr>
                        <tr>
                            <td>
                                <img src="/images/spacer.gif" width="1" height="1"></td>
                        </tr>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="bglist-3" width="12%">Title：</td>
                            <td  class="bglist-4" width="21%">
                                <asp:DropDownList width="80%" ID="ddlauthorisetitle"  CssClass="input3" runat="server">
                                                <asp:ListItem Text="MR." Value="MR."></asp:ListItem>
                                                <asp:ListItem Text="Mrs." Value="Mrs."></asp:ListItem>
                                                <asp:ListItem Text="Miss." Value="Miss."></asp:ListItem>
                                            </asp:DropDownList></td>
                            <td class="bglist-3" width="12%">First Name ：</td>
                            <td class="bglist-4" width="21%">
                                <input width="80%" class="input3" id="TxtAuthoriseFirstName" type="text"  name="textfield" runat="server"/></td>
                            <td class="bglist-3" width="12%">Last Name ：</td>
                            <td  class="bglist-4" width="21%">
                                <input width="80%" class="input3" id="txtAuthoriseLastName" type="text"  name="textfield2" runat="server"/></td>
                        </tr>
                        <tr>
                            <td class="bglist-3">Home No.：</td>
                          <td class="bglist-4"><input width="80%" class="input3" id="txtAuthoriseHomeNo" type="text"  name="textfield2" runat="server"/></td>
                            <td class="bglist-3">Work No.：</td>
                            <td class="bglist-4">
                                <input width="80%" class="input3" id="txtAuthoriseWorkNo" type="text"  name="textfield" runat="server"/></td>
							<td class="bglist-3">
                                Date Of Birth：</td>
                            <td class="bglist-4">
                                <input width="80%" class="input3" id="txtAuthoriseBirth" type="text"  name="textfield" runat="server"/>&nbsp;<img
                                                style="cursor: hand" onclick="JavaScript:calPopForCMon(txtAuthoriseBirth, 'ss');"
                                                height="14" src="/images/dot_date.gif" width="16" align="absMiddle"></td>
							
                        </tr>
                        <tr>
                            <td class="bglist-3">
                                Address：</td>
                            <td class="bglist-4" colspan="3">
                                <input style="width:92%" width="80%" class="input3" id="txtAuthoriseAddress" type="text"  name="textfield52" runat="server"/></td>    
								<td class="bglist-3">
                                Country：</td>
                            <td class="bglist-4">
                                <input width="80%" class="input3" id="txtAuthoriseCountry" type="text"  name="textfield" runat="server"/></td>                        
                        </tr>
                        <tr>
                            <td class="bglist-3">
                                City：</td>
                            <td class="bglist-4">
                                <input width="80%" class="input3" id="txtAuthoriseCity" type="text" runat="server" name="textfield"/></td>
                            <td class="bglist-3">Region/Province：</td>
                            <td class="bglist-4" colspan="3">
                                <input width="92%" class="input3" id="txtAuthoriseProvince" type="text"  name="textfield" runat="server"/></td>
                        </tr>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <img src="/images/spacer.gif" width="1" height="5"></td>
                        </tr>
                        <tr>
                            <td bgcolor="#1765a7">
                                <img src="/images/spacer.gif" width="1" height="3"></td>
                        </tr>
                        <tr>
                            <td>
                                <img src="/images/spacer.gif" width="1" height="1"></td>
                        </tr>
                    </table>
                    <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td class="bglist-3"  width="12%">
                                Remarks：</td>
                            <td class="bglist-4" colspan="5">
                                <asp:TextBox width="95%" ID="txtremarks" Rows="4" TextMode="multiLine" CssClass="input3" 
                                    runat="server"></asp:TextBox></td>
                        </tr>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <img src="/images/spacer.gif" width="1" height="2"></td>
                        </tr>
                    </table>
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="bglist-3" style="height: 35px;">
                                <div align="right">
                                    <input class="button" id="btnsave" type="submit" value="Save" name="save" runat="server"
                                        onserverclick="save_ServerClick" onclick="return check();" />
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <input class="button" id="btnback" type="submit" value="Back" name="save" runat="server"
                                        onserverclick="btnback_ServerClick" />
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
                <td valign="top" width="10">
                    <img height="1" src="/images/spacer.gif" width="10"></td>
            </tr>
        </table>
        <input id="hiddenflag" value="" type="hidden" runat="server" />
        <input id="hiddenflagname" value="" type="hidden" runat="server" />
    </form>
</body>
</html>
